package com.Tadama.Forms;
import com.Tadama.MIDlet.TadamaMIDlet;
import com.Tadama.Utility.CommandBuilder;
import java.io.IOException;
import javax.microedition.lcdui.Choice;
import javax.microedition.lcdui.ChoiceGroup;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.Image;
import javax.microedition.lcdui.TextField;

public class frmBuscarPedidos extends Form implements CommandListener{
    
    private Displayable previousDisplay;
    private TadamaMIDlet mainMidlet;
    private lstClientes ListaClientes;
    
    private TextField tfCriterio;
    private ChoiceGroup chgCriterios;
    private static final String[]MENU_ITEMS={"Cod.Cliente", "RUC/DNI"};
    private static final Command cmCancelar = CommandBuilder.getCancel();
    private static final Command cmBuscar = CommandBuilder.getBuscar();

    public frmBuscarPedidos(String title,TadamaMIDlet mainMIDlet,Displayable previousDisplay) {
        super(title.trim());
        this.mainMidlet= mainMIDlet;
        this.previousDisplay= previousDisplay;
        init();
    }
    
    private void init() {
        chgCriterios = new ChoiceGroup("Busquecar por", Choice.POPUP, MENU_ITEMS, null);
        chgCriterios.setSelectedFlags(new boolean[]{false, false});
        tfCriterio= new TextField("Criterio", "CLAT102", 20,TextField.ANY);
        this.append(chgCriterios);
        this.append(tfCriterio);        
        this.addCommand(cmBuscar);
        this.addCommand(cmCancelar);
        this.setCommandListener(this);
    }
    
    public Display getDisplay() { return Display.getDisplay(mainMidlet); }
    
    public void commandAction(Command c, Displayable d) {
        if (d == this) {
            if (c == cmBuscar) {
                Display.getDisplay(mainMidlet).setCurrent(new frmWaitScreem(getDisplay(),mainMidlet,this,3));
                //getWaitScreen();
            }
        }
    }
    
}
